home *** CD-ROM | disk | FTP | other *** search
/ F1 Licenseware / F1 Licenseware - Volume 1.iso / disks / 089a.dms / 089a.adf / TEXTS / CHAPTERS_21-30 / Chapter24.txt < prev    next >
Text File  |  1992-03-06  |  4KB  |  101 lines

  1.                      The Absolute Beginners Guide To Amos
  2.                     -------------------------------------
  3.                              Chapter Twenty Four
  4.                             ----------------------
  5. We shall now take a look at a few more commands concerning colour.
  6.  
  7. The COLOUR instruction seems a bit daunting at first, but like most of the 
  8. Amos instruction set it soon becomes fairly straightforward if you spend a 
  9. little time studying it.
  10.  
  11. When you first load Amos the screen COLOURs are set to default. 
  12. If you press escape you will see the infamous yukky brown we all love to 
  13. hate. Wouldn't it be nice if we could change them default colours without
  14. resorting to loading a picture or bob bank?  As you can guess it's all
  15. possible in good old Amos. The default screen is a sixteen colour screen.
  16. The COLOUR numbers run from 0 to 15. These 16 numbers are commonly known as
  17. colour indexes. The first colour index (0) is black and the second COLOUR 
  18. index (1) is the horrid brown. If we were to enter the following line we 
  19. could change that brown to blue:
  20.  
  21.  
  22.  
  23. COLOUR 1,$00F  ----|
  24.        |           |
  25.        |           |
  26.   Colour index     |
  27.                    |
  28.                    |
  29.                RGB values
  30.  
  31.  
  32.  
  33. The 1 is easy, it's the COLOUR index (or COLOUR number if you wish) 
  34. If we wanted to change the black (COLOUR 0) we would of put 0 instead of 1.
  35.  
  36. I am going to have to explain the second part. 
  37. The $00F part is commonly known as an RGB value. You may have come across 
  38. this in a Paint package such as Dpaint 3. RGB stands for Red, Green and Blue.
  39. You have to assign a value to each of these primary colours which Amos will 
  40. then mix for you into a COLOUR. The range of the values are in a format
  41. called Hexadecimal. I am not going to explain the ins and outs of hex here I
  42. will just give you a simple chart:
  43.  
  44.   HEX DIGIT    1 2 3 4 5 6 7 8 9 A  B  C  D  E  F
  45.  
  46.     DECIMAL    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
  47.  
  48. * See APPENDIX for a larger chart.
  49.  
  50. So from the chart you can see that the maximum single digit value you can 
  51. use is F (15) which is the brightest available of the primary colour it is 
  52. assigned to. We assigned $F to B (blue) and 0 to R and 0 to G that works out
  53. as:
  54.  
  55. NO RED    NO GREEN     MAXIMUM BLUE
  56.  
  57. Example24.Amos is a palette requester routine written by a clever chap
  58. called Rob Farnsworth. I have included it here as it allows you to see the 
  59. RGB values of colours and anyway it's a superbly written program. 
  60. Load it now!
  61.  
  62. As seen in Rob's routine you can use the HEX$ instruction to read the COLOUR
  63. assignment of any index:
  64.  
  65. PRINT HEX$(COLOUR(1))
  66.  
  67. Would now return our blue (00F) So if we wanted to put back that horrid 
  68. brown, which incidentally is $A40, all we have to do is:
  69.  
  70. COLOUR 1,$A40
  71.  
  72. and we are back to normal.
  73.  
  74. Now we move on to the PALETTE instruction which is really just a more
  75. powerful version of COLOUR. PALETTE allows you to set as many COLOUR
  76. instructions as you want in one statement. Very handy if you want to change 
  77. a lot of colours in one go:
  78.  
  79. PALETTE $FFF,$00F
  80.  
  81. Would change COLOURs zero and one. PALETTE is quite flexible, you can insert
  82. a comma (,) to skip any COLOUR you do not want to change so if for example
  83. we wanted to change COLOURs 0,1 and 6 we could do this:
  84.  
  85. PALETTE $FFF,$00F,,,$0F0,,,,,,,,,
  86.           |       |   |
  87.           |       |   |
  88.        COLOUR 0   | COLOUR 6,NOW GREEN    
  89.        NOW WHITE  |
  90.                   |
  91.                COLOUR 4
  92.             STAYS AS IT WAS
  93.        AS DO 3 & 5 & 7 ONWARD 
  94.   
  95. To save confusing you I have been putting leading zeros in the RGB values. 
  96. If you put $000 in your Amos listing it will be changed to just $0 for you 
  97. so don't worry if this happens.  Now load Example24.Amos.
  98.  
  99.                               End of Chapter 24
  100.                               ^^^^^^^^^^^^^^^^^
  101.